﻿$(function () {
    var headerCheck = $('.check-header input').first();
    var itemChecks = $('.check-item input');

    headerCheck.click(function () {
        if (headerCheck.attr('checked')) {
            itemChecks.attr('checked', 'check');
        }
        else {
            itemChecks.removeAttr('checked');
        }
    });

    itemChecks.click(function () {
        headerCheck.removeAttr('checked');
    });
});
